/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sdc;

/**
 *
 * @author yokoe
 */
public abstract class StatefulObject
{

	private boolean failed = false;

	public boolean isFailed()
	{
		return failed;
	}

	public void failure()
	{
		failed = true;

		doFailure();
	}

	public void recover()
	{
		if (isFailed() == true)
			failed = false;

		doRecover();
	}

	protected abstract void doFailure();

	protected abstract void doRecover();
}
